%   Copyright (c) [2023] [423109070325付志峰]
%   [春天的高等数学代码库] is licensed under Mulan PSL v2.
%   You can use this software according to the terms and conditions of the Mulan PSL v2. 
%   You may obtain a copy of Mulan PSL v2 at:
%            http://license.coscl.org.cn/MulanPSL2 
%   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
%   See the Mulan PSL v2 for more details. 
%迭代法求解方程
%定义求解函数
syms x
y=-x^2+3*x+3;
fplot(y)
%需要手动定义迭代方程（局限之处）
syms x_5
y_0=(x_5^2-3)/3;
%定义矩阵记录迭代结果
n=input("请输入迭代次数：")
for i=1:n
    ans(i,1)=0
end
%估计
x_0=input("请估计x_0的大概数值：");
ans(1,1)=x_0;

for a=1:n
    x_0=subs(y_0,x_0)
    ans(a+1,1)=x_0
end
vpa(x_0)